{% extends "base.html" %}


{% block body%}

<h3>Temperature</h3>
<h1 id="temperature"></h1>


{% endblock %}

{% block js%}
{{ super() }}
<script type="text/javascript">

        async function fetchTemperature() {
            try {
                const response = await fetch('/temperature');
                const data = await response.json();
                document.getElementById('temperature').innerText = `${data.temperature}`;
            } catch (error) {
                console.error('Error fetching temperature:', error);
            }
        }
    
        document.addEventListener('DOMContentLoaded', fetchTemperature);
    
    
        setInterval(fetchTemperature, 1500);


</script>
{% endblock %}
